package com.smartticket.jeju.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.smartticket.jeju.model.Ticket;
import com.smartticket.jeju.repository.TicketRepository;

@Service
public class TicketServiceImpl implements TicketService {
	
	@Autowired
	private TicketRepository ticketRepository;
	
	public List<Ticket> list() 
	{
		return ticketRepository.findAll();
	}

	public Ticket get(int ticket_id) {
		return ticketRepository.get(ticket_id);
	}

	public int calculatePrice(int price, float discount_rate) {
		
		return (int)(price * (1-discount_rate));
	}

	public int totalTicket(int goal_count) {
		// TODO Auto-generated method stub
		return goal_count * 2;
	}
}
